#include "k8form.h"
#include "ui_k8form.h"
#include <QDebug>
#include <QKeyEvent>

k8Form::k8Form(QWidget *parent) :
  QWidget(parent),
  ui(new Ui::k8Form)
{
  ui->setupUi(this);
  box_sel=NULL;
  QImage *img=GetLogo();
  if(img!=NULL)
      ui->label_Logo->setPixmap(QPixmap::fromImage(*img).scaled(ui->label_Logo->size()));
}

k8Form::~k8Form()
{
}

void k8Form::keyPressEvent(QKeyEvent *event)
{
    int key=event->key();
  qDebug()<< key;
  printf("key= %d\n",key);
    if(key==Qt::Key_F12||key==Qt::Key_Exit)
    {
        if(ShowPreWin())
            this->hide();
    }
    else
        if(ShowWin(key,0))
            this->hide();
}

void k8Form::on_checkBox_clicked()
{
    SelBox(ui->checkBox);
    sendUartCmd_timing(k8_30);
}

void k8Form::on_checkBox_2_clicked()
{
    SelBox(ui->checkBox_2);
    sendUartCmd_timing(k8_29);
}

void k8Form::on_checkBox_3_clicked()
{
    SelBox(ui->checkBox_3);
    sendUartCmd_timing(k8_25);
}

void k8Form::on_checkBox_4_clicked()
{
    SelBox(ui->checkBox_4);
    sendUartCmd_timing(k8_24);
}

void k8Form::on_checkBox_6_clicked()
{
    SelBox(ui->checkBox_6);
    sendUartCmd_timing(k8_60);
}

void k8Form::on_checkBox_7_clicked()
{
    SelBox(ui->checkBox_7);
    sendUartCmd_timing(k8_59);
}

void k8Form::on_checkBox_5_clicked()
{
    SelBox(ui->checkBox_5);
    sendUartCmd_timing(k8_50);
}

void k8Form::on_checkBox_8_clicked()
{
    SelBox(ui->checkBox_8);
    sendUartCmd_timing(k8_23);
}

void k8Form::on_checkBox_10_clicked()
{
    SelBox(ui->checkBox_10);
    sendUartCmd_timing(k8_48);
}

void k8Form::on_checkBox_9_clicked()
{
    SelBox(ui->checkBox_9);
    sendUartCmd_timing(k8_47);
}
